package lab02.test11;

import lab02.test12.Rectangular;

/**
 * Created by JAVA on 2017/10/21.
 */
public class Square extends Rectangle {
    //重写printMyWay()方法，要求该方法能显示正方形的边长、面积、周长和对角线长
    private double  diagonal;

    public void setDiagonal(double diagonal) {
        this.diagonal = diagonal;
    }

    public double getDigonal(){

        diagonal=Math.sqrt(grow*grow+wide*wide);
        return diagonal;
    }
    @Override
    public void printMyWay() {
        super.printMyWay();
        System.out.println("对角线长："+getDigonal());
    }
}
